package com.example.androidlearning2200.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.example.androidlearning2200.LoginActivity;
import com.example.androidlearning2200.MConstant;
import com.example.androidlearning2200.SplashActivity;

/**
 * 收到广播后，打开欢迎界面
 */
public class SplashReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals(MConstant.ACTION_OPEN_SPLASH)) {
            Intent intent2Splash = new Intent(context, SplashActivity.class);
            intent2Splash.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
            context.startActivity(intent2Splash);
        }
    }
}
